﻿using System;

namespace ComponentSystem
{
	/// <summary>
	/// 销毁接口
	/// </summary>
	public interface IDestroySystem
	{
		/// <summary>
		/// 类型
		/// </summary>
		Type Type();

		/// <summary>
		/// 运行
		/// </summary>
		void Run(object o);
	}

	public abstract class DestroySystem<T> : IDestroySystem
	{
		/// <summary>
		/// 运行
		/// </summary>
		public void Run(object o)
		{
			this.Destroy((T)o);
		}

		/// <summary>
		/// 类型
		/// </summary>
		public Type Type()
		{
			return typeof(T);
		}

		/// <summary>
		/// 销毁
		/// </summary>
		public abstract void Destroy(T self);
	}
}
